package week_home_work02;

import java.util.Scanner;

/**
 * @author zdl
 * @date 2024/11/22
 */
public class Demo23 {
    public static void main(String[] args) {
        //判断一个数字是否为回文数。 12321
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个整数:");
        int num = sc.nextInt();
        int yuanNum = num;
        int fanNum = 0;
        while (num != 0){
            int lastNum = num % 10;
            fanNum = fanNum * 10 + lastNum;
            num/=10;
        }
        if (fanNum == yuanNum){
            System.out.println(yuanNum+"是一个回文数");
        }else {
            System.out.println(yuanNum+"不是一个回文数");
        }

    }
}
